import request from "@/utils/request";

// 登录功能
export function loginVerify(data) {
  return request({
    url: "/userAction/loginVerify",
    method: "post",
    data: data,
  });
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: "/captchaImage",
    method: "get",
  });
}

// 获取验证码
export function test() {
  return request({
    url: "/userAction/test",
    method: "post",
  });
}

// 查询当前用户信息
export function profile(userid) {
  return request({
    url: "/userAction/profile?userid="+userid,
    method: "get",
  });
}

// 更新当前用户信息
export function updateProfile(data) {
  return request({
    url: "/userAction/profile",
    method: "put",
    data:data
  });
}

// 用户密码修改
export function updateUserPwd(data) {
  return request({
    url: '/userAction/updatePwd',
    method: 'post',
    data: data
  })
}

// 用户密码重置
export function resetUserPwd(userid) {
  let data = {
    userid: userid,
    newPassword: "123456",
  };
  return request({
    url: '/userAction/resetPwd',
    method: 'post',
    data: data
  })
}

// 查询用户列表
export function listUser(query) {
  return request({
    url: '/userAction/list',
    method: 'get',
    params: query
  })
}


// 用户密码修改
export function addUser(data) {
  return request({
    url: '/userAction/add',
    method: 'post',
    data: data
  })
}

// 用户密码修改
export function removeUser(userid) {
  return request({
    url: '/userAction/'+userid,
    method: 'delete'
  })
}